package com.daylive.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.daylive.dao.CategoryDao;
import com.daylive.model.Category;
import com.daylive.page.Page;


@Service
public class CategoryService {
	private final int PAGE_SIZE = 10;
	@Autowired
	private CategoryDao categoryDao;
	
	public Page< Category> getCategoryList(int pageNumber) {
		Page< Category> page = new Page< Category>(pageNumber, PAGE_SIZE);
		List< Category> list = categoryDao.getCategoryList(page);
		page.setResultList(list);
		return page;
	}
	public List<Category> getCategoryList() {
		List<Category> list = categoryDao.getCategoryList();
		return list;
	}
	public Category getCategoryById(int id) {
		return categoryDao.getCategoryById(id);
	}
	public int addCategory(Category category) {
		return categoryDao.addCategory(category);
	}
	public int updateCategory(Category category) {
		return categoryDao.updateCategory(category);
	}
	public int delCategory(int id) {
		return categoryDao.delCategory(id);
	}
	public int delAll(String[] ids) {
		return categoryDao.delAll(ids);
	}

}
